package com.person.leetcode.editor.cn;

/**
  * 796.旋转字符串
  * 2022-04-07 11:05:36
**/
public class Sequence_0796_RotateString {
    public static void main(String[] args) {
        Solution solution = new Sequence_0796_RotateString().new Solution();
    }
    //leetcode submit region begin(Prohibit modification and deletion)
class Solution {
    public boolean rotateString(String s, String goal) {
        //return A.length() == B.length() && (A + A).contains(B);
        if (s.length() != goal.length()){
            return false;
        }
        StringBuilder match = new StringBuilder(s);
        for (int i = 0; i < s.length(); i++) {
            if (goal.equals(match.toString())){
                return true;
            }else{
                match.append(match.charAt(0));
                match.deleteCharAt(0);
            }
        }
        return false;
    }
}
//leetcode submit region end(Prohibit modification and deletion)

}
